package com.jblog.article.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 文章
 * 
 * @author Bing
 * @time 2015.08.17
 */
@Entity
@Table(name = "article")
public class Article implements Serializable{
	
	private static final long serialVersionUID = -3878874733426700668L;
	
	private String id;
	/** 标题 */
	private String title;
	/** 副标题 */
	private String subTitle;
	/** 作者 */
	private String author;
	/** 概要 */
	private String summary;
	/** 文章主体 */
	private String detail;
	/** 创建时间 */
	private Date createTime;
	/** 更新时间 */
	private Date updateTime;
	/** 序号 */
	private Integer seqNum;
	/** 状态 */
	private Integer status;
	/** 文章列表页图片 */
	private String imgUrl;
	/** 关键词 */
	private String keyWords;
	
	private Category category;

	
	public Article(){
	}
	
	public Article(String id){
		this.id = id;
	}
	
	@Id
	@Column(name = "id", unique = true, nullable = false, length = 32)
	public String getId() {
		return id;
	}

	@Column(name = "title", nullable = false, length = 255)
	public String getTitle() {
		return title;
	}

	@Column(name = "sub_title", length = 255)
	public String getSubTitle() {
		return subTitle;
	}

	@Column(name = "author", length = 32)
	public String getAuthor() {
		return author;
	}

	@Column(name = "summary", length = 1024)
	public String getSummary() {
		return summary;
	}

	@Column(name = "detail", columnDefinition="TEXT", nullable=true)
	public String getDetail() {
		return detail;
	}

	@Column(name = "create_time")
	public Date getCreateTime() {
		return createTime;
	}

	@Column(name = "update_time")
	public Date getUpdateTime() {
		return updateTime;
	}

	@Column(name = "seq_num")
	public Integer getSeqNum() {
		return seqNum;
	}

	@Column(name = "status")
	public Integer getStatus() {
		return status;
	}

	@Column(name = "img_url")
	public String getImgUrl() {
		return imgUrl;
	}

	@Column(name = "keyWords", length = 255)
	public String getKeyWords() {
		return keyWords;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="category_id",nullable=false)
	public Category getCategory() {
		return category;
	}
	
	public void setId(String id) {
		this.id = id;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public void setSubTitle(String subTitle) {
		this.subTitle = subTitle;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public void setSeqNum(Integer seqNum) {
		this.seqNum = seqNum;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}

	public void setKeyWords(String keyWords) {
		this.keyWords = keyWords;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

}
